home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1 / Nebula One.iso / Utilities / Converters / Convert_MacPaint / Source / shared.subproj / RCS / common.c,v < prev    next >
Text File  |  1995-06-12  |  2KB  |  110 lines

  1. head     1.3;
  2. branch   ;
  3. access   ;
  4. symbols  beta10:1.2;
  5. locks    death:1.3;
  6. comment  @ * @;
  7.  
  8.  
  9. 1.3
  10. date     93.04.04.23.45.33;  author death;  state Exp;
  11. branches ;
  12. next     1.2;
  13.  
  14. 1.2
  15. date     93.01.10.15.08.59;  author death;  state Exp;
  16. branches ;
  17. next     1.1;
  18.  
  19. 1.1
  20. date     92.07.26.13.56.59;  author death;  state Exp;
  21. branches ;
  22. next     ;
  23.  
  24.  
  25. desc
  26. @Update
  27. @
  28.  
  29.  
  30. 1.3
  31. log
  32. @Sun Apr  4 23:45:32 PDT 1993
  33. @
  34. text
  35. @#import "common.h"
  36. #import <stdlib.h>
  37. //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  38. //    This function takes an unsigned number, and returns YES if the number is
  39. //    even, and NO otherwise.
  40. //    This test is accomplished simply by getting the remainder of dividing the number
  41. //    by 2.  This remainder will always be either 0 or 1.  If it is 1, then theNum was
  42. //    odd, otherwise it was even.
  43. //    This function is included here because this is occasionally a thing I need to make
  44. //    use of, but alas I always end up spending too much time remembering the operators
  45. //    needed to do it again.  
  46. //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  47.  
  48. Boolean    EvenUnsignedNum (PositiveInteger  theNum)
  49. {
  50.     if  ((theNum % 2) == 1)
  51.         return NO;
  52.     else
  53.         return YES;
  54. }
  55.  
  56.  
  57. CString    NewCString(PositiveInteger length)
  58. {
  59.     CString    temp = (CString) malloc(length+1);
  60.     temp[0] = EndOfCString;
  61.     return temp;
  62. }
  63.  
  64. void    FreeCString(CString theString)
  65. {
  66.     free((char*)theString);
  67. }
  68.  
  69.  
  70. ByteString    NewByteString(PositiveInteger length)
  71. {
  72.     return (ByteString) malloc(length);
  73. }
  74.  
  75. void    FreeByteString(ByteString theString)
  76. {
  77.     free((char*)theString);
  78. }
  79.  
  80.  
  81. Pointer    NewPointer(PositiveInteger length)
  82. {
  83.     return (Pointer) malloc(length);
  84. }
  85.  
  86. void    FreePointer(Pointer thePointer)
  87. {
  88.     free((char*)thePointer);
  89. }
  90. @
  91.  
  92.  
  93. 1.2
  94. log
  95. @Sun Jan 10 15:08:58 PST 1993
  96. @
  97. text
  98. @@
  99.  
  100.  
  101. 1.1
  102. log
  103. @Initial revision
  104. @
  105. text
  106. @d25 3
  107. a27 1
  108.     return (CString) malloc(length+1);
  109. @
  110.